package com.sgzn.sgpay.service.impl.gateway;

import com.sgzn.sgpay.integration.gateway.TrsGateway;
import com.sgzn.sgpay.model.request.able.SgsReqAble;
import com.sgzn.sgpay.model.response.SgsResultResponse;
import org.springframework.integration.Message;

import javax.annotation.Resource;

/**
 * 请求入口
 * @author zhongzhongyong
 * @version Id: AbstractGateWay.java, v 0.1 2018/4/5 14:08 zhongzhongyong Exp $$
 */
public abstract class AbstractGateWay {

    @Resource
    protected TrsGateway trsGateway;

    protected SgsResultResponse execute(SgsReqAble request) {
        Message rsp = trsGateway.sendRequest(request);
        return (SgsResultResponse) rsp.getPayload();
    }

}
